export default async function({ req, store, $axios, redirect, route }) {
  if (Object.keys(store.state.systemStyle) === 0) {
    const res = await $axios.get('/site/systemStyle/getSiteBydomain')
    if (res.code === 1001) {
      store.commit('updateSystemStyle', res.body || {})
    }
  }
   const { frontStyle } = store.state.systemStyle
  // const frontStyle = 4 //风格
  const name = route.name
  if(frontStyle===4){
    // if (/themes|themes1/.test(name)) redirect('/themes4')
    // if (/register/.test(name)) redirect('/register4')
     if (/index/.test(name)) {
      route.name !== 'index4' && redirect('/index4')
    }
    // if (/account/.test(name)) redirect('/account4')
    if (/main/.test(name)) {
      route.name !== 'main4' && redirect('/main4')
    }
    // if (/thirdRegister/.test(name)) redirect('/thirdRegister4')
     // if (/category-list/.test(name)) redirect('/category-list4')
  }
  if(frontStyle===3){
    if (/themes|themes1|index/.test(name)) redirect('/themes1')
  }
  if (frontStyle === 2) {
    if (/themes|index/.test(name)) redirect('/themes')
  }
  if (frontStyle === 1)  {
    if (/themes|index/.test(name)) redirect('/')
  }
  if (frontStyle === "")  {
    if (/themes|index/.test(name)) redirect('/')
  }
}
